#ifndef __MAVLINKPARAM_H__
#define __MAVLINKPARAM_H__

#include "mathTool.h"

enum
{
    /*System*/
    SYS_AUTOSTART,
    SYS_AUTOCONFIG,
    SYS_PARAM_VER,
    /*MAVLink*/
    MAV_SYS_ID,
    MAV_COMP_ID,
    MAV_PROTO_VER,
    MAV_RADIO_ID,
    MAV_AIRFRAME_TYPE,
    MAV_USEHILGPS,
    MAV_FWDEXTSP,
    MAV_BROADCAST,
    /*Sensor Calibration*/
    CAL_BOARD_ID,
    CAL_GYRO0_ID,
    CAL_GYRO0_XOFF,
    CAL_GYRO0_YOFF,
    CAL_GYRO0_ZOFF,
    CAL_GYRO0_XSCALE,
    CAL_GYRO0_YSCALE,
    CAL_GYRO0_ZSCALE,
    CAL_MAG0_ID,
    CAL_MAG1_ID,
    CAL_MAG2_ID,
    CAL_MAG0_ROT,
    CAL_MAG1_ROT,
    CAL_MAG2_ROT,
    CAL_MAG0_XOFF,
    CAL_MAG0_YOFF,
    CAL_MAG0_ZOFF,
    CAL_MAG0_XSCALE,
    CAL_MAG0_YSCALE,
    CAL_MAG0_ZSCALE,
    CAL_ACC0_ID,
    CAL_ACC0_XOFF,
    CAL_ACC0_YOFF,
    CAL_ACC0_ZOFF,
    CAL_ACC0_XSCALE,
    CAL_ACC0_YSCALE,
    CAL_ACC0_ZSCALE,
    CAL_ACC_PRIME,
    CAL_GYRO_PRIME,
    CAL_MAG_PRIME,
    CAL_MAG_SIDES,
    CAL_BARO_PRIME,
    SENS_DPRES_OFF,
    SENS_DPRES_ANSC,
    SENS_BARO_QNH,
    SENS_BOARD_ROT,
    SENS_FLOW_ROT,
    SENS_BOARD_X_OFF,
    SENS_BOARD_Y_OFF,
    SENS_BOARD_Z_OFF,
    SENS_EXT_MAG_ROT,
    SENS_EXT_MAG,
    /*Radio Calibration*/
    TRIM_ROLL,
    TRIM_PITCH,
    TRIM_YAW,
    RC1_MIN,
    RC1_TRIM,
    RC1_MAX,
    RC1_REV,
    RC1_DZ,
    RC2_MIN,
    RC2_TRIM,
    RC2_MAX,
    RC2_REV,
    RC2_DZ,
    RC3_MIN,
    RC3_TRIM,
    RC3_MAX,
    RC3_REV,
    RC3_DZ,
    RC4_MIN,
    RC4_TRIM,
    RC4_MAX,
    RC4_REV,
    RC4_DZ,
    RC5_MIN,
    RC5_TRIM,
    RC5_MAX,
    RC5_REV,
    RC5_DZ,
    RC6_MIN,
    RC6_TRIM,
    RC6_MAX,
    RC6_REV,
    RC6_DZ,
    RC7_MIN,
    RC7_TRIM,
    RC7_MAX,
    RC7_REV,
    RC7_DZ,
    RC8_MIN,
    RC8_TRIM,
    RC8_MAX,
    RC8_REV,
    RC8_DZ,
    RC9_MIN,
    RC9_TRIM,
    RC9_MAX,
    RC9_REV,
    RC9_DZ,
    RC10_MIN,
    RC10_TRIM,
    RC10_MAX,
    RC10_REV,
    RC10_DZ,
    RC11_MIN,
    RC11_TRIM,
    RC11_MAX,
    RC11_REV,
    RC11_DZ,
    RC12_MIN,
    RC12_TRIM,
    RC12_MAX,
    RC12_REV,
    RC12_DZ,
    RC13_MIN,
    RC13_TRIM,
    RC13_MAX,
    RC13_REV,
    RC13_DZ,
    RC14_MIN,
    RC14_TRIM,
    RC14_MAX,
    RC14_REV,
    RC14_DZ,
    RC15_MIN,
    RC15_TRIM,
    RC15_MAX,
    RC15_REV,
    RC15_DZ,
    RC16_MIN,
    RC16_TRIM,
    RC16_MAX,
    RC16_REV,
    RC16_DZ,
    RC17_MIN,
    RC17_TRIM,
    RC17_MAX,
    RC17_REV,
    RC17_DZ,
    RC18_MIN,
    RC18_TRIM,
    RC18_MAX,
    RC18_REV,
    RC18_DZ,
    /*Radio Switches*/
    RC_MAP_ROLL,
    RC_MAP_PITCH,
    RC_MAP_YAW,
    RC_MAP_THROTTLE,
    RC_MAP_FAILSAFE,
    RC_MAP_MODE_SW,
    RC_MAP_RETURN_SW,
    RC_MAP_FLAPS,
    RC_MAP_RATT_SW,
    RC_MAP_POSCTL_SW,
    RC_MAP_LOITER_SW,
    RC_MAP_ACRO_SW,
    RC_MAP_OFFB_SW,
    RC_MAP_KILL_SW,
    RC_MAP_AUX1,
    RC_MAP_AUX2,
    RC_MAP_AUX3,
    RC_MAP_AUX4,
    RC_MAP_AUX5,
    RC_MAP_PARAM1,
    RC_MAP_PARAM2,
    RC_MAP_PARAM3,
    RC_MAP_FLTMODE,
    RC_FAILS_THR,
    RC_ASSIST_TH,
    RC_AUTO_TH,
    RC_RATT_TH,
    RC_POSCTL_TH,
    RC_RETURN_TH,
    RC_LOITER_TH,
    RC_ACRO_TH,
    RC_OFFB_TH,
    RC_KILLSWITCH_TH,
    RC_CHAN_CNT,
    RC_TH_USER,
    /*Commander*/
    COM_DL_LOSS_T,
    COM_DL_REG_T,
    COM_EF_THROT,
    COM_EF_C2T,
    COM_EF_TIME,
    COM_RC_LOSS_T,
    COM_HOME_H_T,
    COM_HOME_V_T,
    COM_AUTOS_PAR,
    COM_RC_IN_MODE,
    COM_RC_ARM_HYST,
    COM_DISARM_LAND,
    COM_LOW_BAT_ACT,
    /*Battery Calibration*/
    BAT_H_CURR,
    BAT_V_CURR,
    BAT_C_SAFE,
    BAT_C_SAFE_UB,
    BAT_V_SCALE_IO,
    BAT_CNT_V_VOLT,
    BAT_CNT_V_CURR,
    BAT_V_OFFS_CURR,
    BAT_V_DIV,
    BAT_A_PER_V,
    BAT_V_EMPTY,
    BAT_V_CHARGED,
    BAT_LOW_THR,
    BAT_CRIT_THR,
    BAT_EMERGEN_THR,
    BAT_V_LOAD_DROP,
    BAT_N_CELLS,
    BAT_CAPACITY,
    /*Mission*/
    NAV_DLL_ACT,
    NAV_RCL_ACT,
    /*Return To Land*/
    RTL_RETURN_ALT,
    RTL_DESCEND_ALT,
    RTL_LAND_DELAY,
    RTL_MIN_DIST,
    /*Miscellaneous*/
    COM_FLTMODE1,
    COM_FLTMODE2,
    COM_FLTMODE3,
    COM_FLTMODE4,
    COM_FLTMODE5,
    COM_FLTMODE6,
    /*Geofence*/
    GF_ACTION,
    GF_ALTMODE,
    GF_SOURCE,
    GF_COUNT,
    GF_MAX_HOR_DIST,
    GF_MAX_VER_DIST,
    GF_FENCE_SW,
    /*Multicopter Attitude Control*/
    MC_ROLL_TC,
    MC_PITCH_TC,
    MC_ROLL_P,
    MC_ROLLRATE_P,
    MC_ROLLRATE_I,
    MC_ROLLRATE_D,
    MC_PITCH_P,
    MC_PITCHRATE_P,
    MC_PITCHRATE_I,
    MC_PITCHRATE_D,
    MC_YAW_P,
    MC_YAWRATE_P,
    MC_YAWRATE_I,
    MC_YAWRATE_D,
    /*Multicopter Position Control*/
    MPC_THR_MIN,
    MPC_THR_HOVER,
    MPC_THR_MAX,
    MPC_MANTHR_MIN,
    MPC_MANTHR_MAX,
    MPC_Z_P,
    MPC_Z_VEL_P,
    MPC_Z_VEL_I,
    MPC_Z_VEL_D,
    MPC_XY_P,
    MPC_XY_VEL_P,
    MPC_XY_VEL_I,
    MPC_XY_VEL_D,

    MAV_PARAM_NUM
};

bool MavParamSendCheck(void);
void MavParamSendEnable(int16_t num);
void MavParamSendEnableAll(void);
float MavParamGetValue(uint16_t num);
void MavParamSetValue(uint16_t num, float value);
int MavParamGetIdByName(char *name);
void MavParamSetDefault(void);
const char* MavParamGetString(uint16_t num);

#endif
